package com.sj.uabrowser.mvp.settings.view.act;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.sj.uabrowser.R;
import com.sj.uabrowser.app.StatusBarUtil;
import com.sj.uabrowser.framework.BaseActivity;
import com.sj.uabrowser.framework.BasePresenter;
import com.umeng.analytics.MobclickAgent;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;

public class FeedBackAct extends BaseActivity {

    @BindView(R.id.text)
    EditText text;
    @BindView(R.id.fankui)
    TextView fankui;
    boolean modifyFankuibg = true;

    @Override
    public BasePresenter createPresenter() {
        return null;
    }

    @Override
    public int getLayoutID() {
        return R.layout.activity_feed_back;
    }

    @Override
    public void setView() {
        StatusBarUtil.setTranslucentForImageViewInFragment(this,0,null);
        StatusBarUtil.setLightMode(this);
        setTopTitle("问题反馈");
        text.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                if (s.toString().equals("")) {
                    //灰色
                    if (!modifyFankuibg) {
                        fankui.setBackgroundResource(R.drawable.shape_code_disable_corner);
                    }
                    modifyFankuibg = true;
                } else {
                    //带颜色
                    if (modifyFankuibg) {
                        fankui.setBackgroundResource(R.drawable.shape_login_cornerbg);
                    }
                    modifyFankuibg = false;
                }
            }
        });

        fankui.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (text.getText().toString().equals("")) {
                    Toast.makeText(FeedBackAct.this, "请输入反馈内容", Toast.LENGTH_SHORT).show();
                    return;
                }
                Toast.makeText(FeedBackAct.this, "反馈成功！", Toast.LENGTH_SHORT).show();
                finish();
            }
        });

    }

    @Override
    public void setData() {

    }
}
